Skip to content

fix: native token should allow version field#420

Merged
tuliomir merged 1 commit into
masterfrom
fix/native-token-version
May 11, 2026
Merged

fix: native token should allow version field#420
tuliomir merged 1 commit into
masterfrom
fix/native-token-version

Conversation

@tuliomir
Copy link
Copy Markdown
Contributor

@tuliomir tuliomir commented May 8, 2026

Motivation

Fix the crash on the Wallet Service testnet after the version field has been added to the Fullnode /version endpoint

A joi validation on the lambda side expects the native_token object to not have the new version property, which it now has.

Current fullnode response:

{
   "version":"0.70.0-rc.1",
   "network":"testnet-india",
   "nano_contracts_enabled":true,
   "min_weight":8,
   "min_tx_weight":8,
   "min_tx_weight_coefficient":0.0,
   "min_tx_weight_k":0.0,
   "token_deposit_percentage":0.01,
   "reward_spend_min_blocks":300,
   "max_number_inputs":255,
   "max_number_outputs":255,
   "decimal_places":2,
   "genesis_block_hash":"000001b7d5abc44d3828529654e8d830eeca1cd0e313032be1b8e9dfe31052ee",
   "genesis_tx1_hash":"00768e4df506979bb14e0efc16748d9306fa176de54e86069d115e74b26957df",
   "genesis_tx2_hash":"00306abcedddfa21707e7920fe324a997e3a311a959a18724c7e8cfd0468c164",
   "native_token":{
      "name":"Hathor",
      "symbol":"HTR",
      "version":0
   }
}

Source:

native_token: Joi.object({
name: Joi.string().min(1).max(30).required(),
symbol: Joi.string().min(1).max(5).required(),
}),

This makes it break with

{
  "level":"error",
  "message":"[wallet-service-india-getVersionData] Unhandled error on /version: Error: \"native_token.version\" is not allowed"
}

Acceptance Criteria

  • Adds the field version to the expected fullnode native_token object

Checklist

  • If you are requesting a merge into master, confirm this code is production-ready and can be included in future releases as soon as it gets merged
  • Make sure either the unit tests and/or the QA tests are capable of testing the new features
  • Make sure you do not include new dependencies in the project unless strictly necessary and do not include dev-dependencies as production ones. More dependencies increase the possibility of one of them being hijacked and affecting us.

Summary by CodeRabbit

  • Chores
    • Enhanced native token configuration validation to support version field tracking.

@tuliomir tuliomir self-assigned this May 8, 2026
@tuliomir tuliomir added the bug Something isn't working label May 8, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 8, 2026

Review Change Stack
No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5a089a4e-db1d-48f8-913c-9c5da3dcf2ab

📥 Commits

Reviewing files that changed from the base of the PR and between 0654434 and e9f3bc7.

📒 Files selected for processing (1)
  • packages/wallet-service/src/schemas.ts

📝 Walkthrough

Walkthrough

The PR extends FullnodeVersionSchema to validate a new version field as an integer within the native_token object, alongside existing name and symbol validations.

Changes

Schema Validation Update

Layer / File(s) Summary
Native Token Version Field
packages/wallet-service/src/schemas.ts
FullnodeVersionSchema's native_token object adds version: Joi.number().integer() validation.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Suggested reviewers

  • pedroferreira1

Poem

🐰 A token needs a version now,
Integer validation's ready,
Schemas keep the data clean,
Field by field, validation's steady,
One small change, but mighty!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and clearly describes the main change: extending the native_token schema to allow a version field validation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/native-token-version

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@tuliomir tuliomir moved this from Todo to In Progress (Done) in Hathor Network May 8, 2026
@github-project-automation github-project-automation Bot moved this from In Progress (Done) to In Review (WIP) in Hathor Network May 9, 2026
@tuliomir tuliomir merged commit c4104b5 into master May 11, 2026
3 checks passed
@github-project-automation github-project-automation Bot moved this from In Review (WIP) to Waiting to be deployed in Hathor Network May 11, 2026
@tuliomir tuliomir deleted the fix/native-token-version branch May 11, 2026 13:03
@luislhl luislhl mentioned this pull request May 11, 2026
2 tasks
tuliomir added a commit that referenced this pull request May 11, 2026
Adds direct schema unit tests for FullnodeVersionSchema, two
fullnode.version() tests, and a live-fullnode contract test that
fails CI when the /version response stops matching the schema.

Aligns FullNodeApiVersionResponse with the native_token.version
field added in #420 and drops
the type cast that was masking the drift.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
tuliomir added a commit that referenced this pull request May 12, 2026
Wraps the three version()-related cases in a `describe('version', ...)`
block for readability. Adds a case asserting `fullnode.version()` still
parses successfully when the fullnode response omits the new
`native_token.version` field, mirroring older fullnodes that predate
#420.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@tuliomir tuliomir moved this from Waiting to be deployed to Done in Hathor Network May 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants